import java.util.Scanner;

public class Test2 {
     public  static  int isQuit = 0 ;
    public static void main(String[] args) {
        Thread t1 = new Thread(()->{
            while (isQuit == 0){
                try {
                    Thread.sleep(10);
                } catch (InterruptedException e) {
                    throw new RuntimeException(e);
                }
            }
            System.out.println("t1 结束");
        });
        t1.start();

        Thread t2 = new Thread(()->{
            //输入一个值，改变isQuit，让t1的循环停止
            Scanner scan = new Scanner(System.in);
            System.out.println("输入值");
            //输入不为0，t1循环停止
            isQuit =scan.nextInt();
        });

        t2.start();


    }
}
